package Engine.RMI
{
	import Framework.Serialize.*;
	
	public class ERMIDispatchStatus extends Object
	{
		public var __value:int;
		private static const __T:Array = ["DispatchOK", "DispatchTimeOut", "DispatchException", "DispatchObjectNotExist", "DispatchOperationNotExist", "DispatchAsync"];
		private static var __values:Array = new Array();
		public static const _DispatchOK:int = 0;
		public static const DispatchOK:ERMIDispatchStatus = new ERMIDispatchStatus(_DispatchOK);
		public static const _DispatchTimeOut:int = 1;
		public static const DispatchTimeOut:ERMIDispatchStatus = new ERMIDispatchStatus(_DispatchTimeOut);
		public static const _DispatchException:int = 2;
		public static const DispatchException:ERMIDispatchStatus = new ERMIDispatchStatus(_DispatchException);
		public static const _DispatchObjectNotExist:int = 3;
		public static const DispatchObjectNotExist:ERMIDispatchStatus = new ERMIDispatchStatus(_DispatchObjectNotExist);
		public static const _DispatchOperationNotExist:int = 4;
		public static const DispatchOperationNotExist:ERMIDispatchStatus = new ERMIDispatchStatus(_DispatchOperationNotExist);
		public static const _DispatchAsync:int = 5;
		public static const DispatchAsync:ERMIDispatchStatus = new ERMIDispatchStatus(_DispatchAsync);
		
		public function ERMIDispatchStatus(value:int)
		{
			this.__value = value;
			__values[value] = this;
		}
		
		public function value() : int
		{
			return this.__value;
		}
		
		public function toString() : String
		{
			return __T[this.__value];
		}
		
		public function equals(model:Object) : Boolean
		{
			if (model == this)
			{
				return true;
			}
			if (model == null)
			{
				return false;
			}
			
			return this.__value == model.value();
		}
		
		public function hashCode() : int
		{
			return 5 * this.__value;
		}
		
		public function __write(stream:SerializeStream) : void
		{
			stream.writeByte(this.__value);
		}
		
		public static function convert(value:int) : ERMIDispatchStatus
		{
			return __values[value];
		}
		
		public static function __read(stream:SerializeStream) : ERMIDispatchStatus
		{
			var byte:* = stream.readByte();
			if (byte < 0 || byte >= 6)
			{
				throw new MarshalException();
			}
			return ERMIDispatchStatus.convert(byte);
		}
	}
}
